package com.wangshouyu.mp.pay.v3.transactions;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;

import java.util.Objects;

/**
 * @author 王守钰
 * @description jsapi下单
 * @date 2020/8/14 9:52
 */
public class JsApiTransactionsRequest extends BaseTransactionsRequest{

    /**
     * 支付者
     */
    @SerializedName(value = "payer")
    @JsonProperty(value = "payer")
    @JSONField(name = "payer")
    private TransactionPayer payer;

    public TransactionPayer getPayer() {
        return payer;
    }

    public void setPayer(TransactionPayer payer) {
        this.payer = payer;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        JsApiTransactionsRequest that = (JsApiTransactionsRequest) o;
        return Objects.equals(payer, that.payer);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), payer);
    }

    @Override
    public String toString() {
        return "JsApiTransactionsRequest{" +
                "payer=" + payer +
                '}';
    }
}
